package org.yray.net.ssdp.server;

public class MessBuilder {
    private final static String REQUEST_HEADER = "M-SEARCH * HTTP/1.1\r\n";
    private final static String HOST_HEADER = "HOST: 239.255.255.250:1900\r\n";
    private final static String MAN_HEADER = "MAN: \"ssdp:discover\"\r\n";
    private final static String MX_HEADER = "MX: %s\r\n";
    private final static String ST_HEADER = "ST: %s\r\n";
    private final static String LINE_BREAK = "\r\n";


    public final static  String ST_ALL = "ssdp:all";

    public static String createMsg(int mx, String st) {
        //Creates The Search Request
        String request =
                REQUEST_HEADER +
                        HOST_HEADER +
                        MAN_HEADER +
                        String.format(MX_HEADER.toString(), mx) +
                        String.format(ST_HEADER, st) +
                        LINE_BREAK;
        return request;
    }
}
